<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8">
        <title>贡献榜 | <?php echo ($site_name_cn); ?>安全应急响应中心</title>
        <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
        <meta name="description" content="<?php echo ($site_name_cn); ?>安全应急响应中心,<?php echo ($site_name_en); ?> Security Response Center">
        <meta name="keywords" content="<?php echo ($site_name_cn); ?>,<?php echo ($site_name_en); ?>,安全团队,应急响应,<?php echo ($site_name_cn); ?>安全应急响应中心,<?php echo ($site_name_en); ?> Security Response Center">
        <meta name="renderer" content="webkit">
        <meta name="viewport" content="width=device-width, initial-scale=0.5, maximum-scale=0.5, minimum-scale=0.5, user-scalable=no">
        <link rel="icon" href="/Public/Index/images/logo.ico">
        <link rel="stylesheet" href="/Public/Index/css/main.css">
        <!--[if (gte IE 6)&(lte IE 8)]>
        兼容 CSS3 选择器
        <script type="text/javascript" src="/Public/Index/js/selectivizr.min.js"></script>
        兼容 media query
        <script type="text/javascript" src="/Public/Index/js/respond.min.js"></script>
        <![endif]-->
    </head>
    <body>
        <div class="header">
            <div>
                <div class="logo">
                    <a href="">
                        <div class="logo_pic">
                        </div>
                        <div class="logo_name">
                            <p><?php echo ($site_name_cn); ?>安全应急响应中心</p>
                            <p><?php echo ($site_name_en); ?> Security Response Center</p>
                        </div>
                    </a>
                </div>

                <div class="userpanel">
                    <div class="userpanel_line">
                        <div></div>
                    </div>
					<?php if(empty($username)): ?><div class="userpanel_login" style="display:block">
                        <a class="mod-btn mod-btn-black login-btn-1 login-qq" href="/user.php?m=user&c=post&a=add">登录账户</a>
                    </div>
					<?php else: ?> 
                    <div class="userpanel_user">
                        <img class="user_avatar mod-avatar-30" src="/Public/Uploads/<?php echo session('avatar');?>" alt="">
                        <span class="user_username"><?php echo session('username'); if(session('mnum') == 0): else: ?><i class="i-header-message"><?php echo session('mnum');?></i><?php endif; ?></span>
                        <i class="user_arrow"></i>
                        <div class="user_menu">
                            <ul class="menu_list">
                                <li class="list_item list_item-user">
                                    <a href="/user.php">
                                        <i class="item_icon"></i>
                                        <span class="item_text">个人主页</span>
                                    </a>
                                </li>
                                <li class="list_item list_item-message">
                                    <a href="/user.php?m=user&c=message&a=index">
                                        <i class="item_icon"></i>
                                        <span class="item_text">消息中心</span>
                                        <i class="item_icon-message"><?php echo session('mnum');?></i>
                                    </a>
                                </li>
                                <li class="list_item list_item-account">
                                    <a href="/user.php?m=user&c=info&a=index">
                                        <i class="item_icon"></i>
                                        <span class="item_text">账户设置</span>
                                    </a>
                                </li>
                                <li class="list_item list_item-logout">
                                    <a href="<?php echo U('login/logout');?>">
                                        <i class="item_icon"></i>
                                        <span class="item_text">注销</span>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div><?php endif; ?>
				</div>

                <div class="nav">
                    <ul>
                        <li class="[index_banner]"><a href="<?php echo U('index/index');?>">首页</a></li>
                        <li class="[banner_selected]"><a href="/user.php?m=user&c=post&a=add">提交漏洞</a></li>
                        <li class="[annoucment_banner]"><a href="<?php echo U('page/index');?>">公告</a></li>
						<li class="[blog_banner]"><a href="<?php echo U('blog/index');?>">博客</a></li>
						<li class="nav_item-active"><a href="<?php echo U('hall/index');?>">贡献榜</a></li>
                        <li class="[gift_banner]"><a href="<?php echo U('gift/index');?>">礼品兑换</a></li>
                    </ul>
                </div>
            </div>
        </div>

     <div class="container container-rank">
            <div>
                <!-- section-subnav 标题-->
                <div class="section section-subnav">
                    <div class="section_subnav">
                        <p class="subnav_title"><a href="#">贡献榜</a></p>
                        <div class="subnav_bgtext"></div>
                    </div>
                </div>

                <div class="section section-rank">
                    <div class="section_rank">
                        <div class="rank_nav">
                            <div class="nav_rankselect">
                                <ul class="mod-grouptabs">
									<li id="total_count" class="grouptabs_item grouptabs_item-active">
                                        <a href="<?php echo U('hall/index');?>">总排行榜</a>
                                    </li>
									<li id="year_count" class="grouptabs_item">
                                        <a href="javascript:query_hall('year');">年排行榜</a>
                                    </li>
                                    <li id="month_count" class="grouptabs_item">
                                        <a href="javascript:query_hall('month');">月排行榜</a>
                                    </li>
                                </ul>
                                <div class="rankselect_form">
                                    <div class="form_time">
                                        <label for="">时间</label>
                                        <select name="" id="year_val">
											<option value="all">全部</option>
											<?php if(is_array($year_hub)): foreach($year_hub as $key=>$year): ?><option value="<?php echo ($year); ?>"><?php echo ($year); ?>年</option><?php endforeach; endif; ?>
                                        </select>
                                        <select name="" id="month_val" onchange="query_hall_by_day();">
											<option value="all">全部</option>
                                            <option value="1">1月</option>
                                            <option value="2">2月</option>
                                            <option value="3">3月</option>
                                            <option value="4">4月</option>
                                            <option value="5">5月</option>
                                            <option value="6">6月</option>
                                            <option value="7">7月</option>
                                            <option value="8">8月</option>
                                            <option value="9">9月</option>
                                            <option value="10">10月</option>
                                            <option value="11">11月</option>
                                            <option value="12">12月</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <table class="rank_table">
                            <thead>
                                <tr>
                                    <th class="th-1">排行</th>
                                    <th class="th-2">昵称</th>
                                    <th class="th-3">团队</th>
                                    <th class="th-5">贡献值</th>
                                </tr>
                            </thead>
                            <tbody id="tbody">
								<?php if(is_array($user)): foreach($user as $k=>$v): ?><tr id="hall_recored">
                                    <td class="td-rank-<?php echo ($k+1); ?>"><i><?php echo ($k+1); ?></i></td>
                                    <td><img class="mod-avatar mod-avatar-50" src="/Public/Uploads/<?php echo ($v["avatar"]); ?>" alt=""><a href="<?php echo U('hall/view?pid='); echo ($v['pid']); ?>"><?php echo ($v['username']); ?></a></td>
                                    <td><?php echo ($v['team']); ?></td>
                                    <td><?php echo ($v['sum(points)']); ?></td>
                                </tr><?php endforeach; endif; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
		<script>
		function query_hall(range_val){
							$.ajax({
								url: "/index.php?m=user&c=hall&a=sortdata",
								type: "POST",
								data: {range:range_val},
								success: function (data) {
									var myDate = new Date();
									var year_num = myDate.getFullYear();
									var month_num = myDate.getMonth()+1;
									if (range_val=="year"){
										$("#total_count").attr("class","grouptabs_item");
										$("#month_count").attr("class","grouptabs_item");
										$("#year_count").attr("class","grouptabs_item grouptabs_item-active");
										$("select option").removeAttr("selected");
										$("#year_val")>$("[value|='" + year_num + "']").attr('selected','selected');
									} else {
										$("#total_count").attr("class","grouptabs_item");
										$("#year_count").attr("class","grouptabs_item");
										$("#month_count").attr("class","grouptabs_item grouptabs_item-active");
										$("select option").removeAttr("selected");
										$("#year_val")>$("[value|='" + year_num + "']").attr('selected','selected');
										$("#month_val")>$("[value|='" + month_num + "']").attr('selected','selected');
									}
									if (data.status == "1") {
										$("#tbody").empty();
										$.each(data.result,function(i,item){
											var index = i + 1;
											$("#tbody").append("<tr id=\"hall_recored\"><td class=\"td-rank-"+ index +"\"><i>"+ index +"</i></td><td><img class=\"mod-avatar mod-avatar-50\" src=\"/Public/Uploads/"+ item['avatar'] +"\" alt=\"\"><a href=\"<?php echo U('hall/view?pid=');?>" + item['pid'] + "\">"+ item['username'] + "</a></td><td>"+ item['team'] +"</td><td>"+ item['sum(points)']+"</td></tr>");
										});
									}else{
										$("#tbody").empty();
									}
									//$("#imgWait").hide();
								},
								error: function () {
									$("#address_fail").css("display","block");
								}
							});
		}
		
		function query_hall_by_day(){
							var year_val = $("#year_val").val();
							var month_val = $("#month_val").val();
							$.ajax({
								url: "/index.php?m=user&c=hall&a=sortdata",
								type: "POST",
								data: {range:'custom',year:year_val,month:month_val},
								success: function (data) {
									$("#total_count").attr("class","grouptabs_item");
									$("#year_count").attr("class","grouptabs_item");
									$("#month_count").attr("class","grouptabs_item grouptabs_item-active");
									if (data.status == "1") {
										$("#tbody").empty();
										$.each(data.result,function(i,item){
											var index = i + 1;
											$("#tbody").append("<tr id=\"hall_recored\"><td class=\"td-rank-"+ index +"\"><i>"+ index +"</i></td><td><img class=\"mod-avatar mod-avatar-50\" src=\"/Public/Uploads/"+ item['avatar'] +"\" alt=\"\"><a href=\"<?php echo U('hall/view?pid=');?>" + item['pid'] + "\">"+ item['username'] + "</a></td><td>"+ item['team'] +"</td><td>"+ item['sum(points)']+"</td></tr>");
										});
									}else{
										$("#tbody").empty();
									}
								},
								error: function () {
									$("#address_fail").css("display","block");
								}
							});
		}
		</script>
 <!-- footer -->
        <div class="footer" style="bottom:0px;left:0px;">
            <div>
                <div class="footer_about">
                    <p class="about_link">
                        <a href="<?php echo ($site_about); ?>" target="_blank">关于<?php echo ($site_name_cn); ?></a>
                        |
                        <a href="<?php echo ($site_career); ?>">加入我们</a>
                        |
                        <a href="/user.php?m=user&c=post&a=add">报告漏洞</a>
                    </p>
                    <p class="about_copyright">
                        <span>Copyright &copy; <?php echo date('Y'); ?> <?php echo ($site_copyright); ?>. All Rights Reserved</span>
						<span>Powered by <a href="https://security.tencent.com/index.php/xsrc">Tencent xSRC</a></span>
                    </p>
                </div>

                <div class="footer_contact">
                    <a class="contact_icon-email" href="mailto:<?php echo ($site_email); ?>"><i></i><span>专用邮箱</span>|</a>
                    <a class="contact_icon-weixin mod-qrcode" href="">
                        <i></i><span>微信公众号</span>
                        <div class="qrcode">
                            <div class="qrcode_pic">
                                <img src="<?php echo ($site_wechat); ?>" alt="">
                            </div>
                            <span class="qrcode_text">扫一扫关注公众号</span>
                        </div>
                    </a>
                </div>
            </div>
        </div>

        <script src="/Public/Index/js/jquery-1.7.2.min.js"></script>
        <script src="/Public/Index/js/test.js"></script>
		<!--xSRC首页统计，正式运营可删除-->
		<script>
		   var _mtac = {};
		   (function() {
			   var mta = document.createElement("script");
			   mta.src = "//pingjs.qq.com/h5/stats.js?v2.0.4";
			   mta.setAttribute("name", "MTAH5");
			   mta.setAttribute("sid", "500696164");
			   var s = document.getElementsByTagName("script")[0];
			   s.parentNode.insertBefore(mta, s);
			})();
		</script>
		
		<?php echo (htmlspecialchars_decode($site_analytics)); ?>
		
    </body>
</html>